import { axios } from '@/utils/request'
import { mimeMap, resolveBlob } from '@/utils/download'

const api = {
  memberAdd: '/biz/member/add',

  centerGetList: '/biz/center/getList',
  centerAdd: '/biz/center/add',
  centerEdit: '/biz/center/edit',
  centerDel: '/biz/center/del',

  memberStatistics: '/biz/statistics/member/recovery',
  memberRenderDtl: '/biz/statistics/member/renderDtl',
  memberRenderCustomDtl: '/biz/statistics/member/renderCustomDtl',
  memberUpdCustom: '/biz/statistics/member/update/custom',
  memberPublishData: '/biz/statistics/member/publishData',
  memberRenderRealDtl: '/biz/statistics/member/renderRealDtl',

  levelStatistics: '/biz/statistics/level/recovery',
  levelRenderDtl: '/biz/statistics/level/renderDtl',
  levelRenderCustomDtl: '/biz/statistics/level/renderCustomDtl',
  levelUpdCustom: '/biz/statistics/level/update/custom',
  levelPublishData: '/biz/statistics/level/publishData',
  levelRenderRealDtl: '/biz/statistics/level/renderRealDtl',

  ratingStatistics: '/biz/statistics/rating/recovery',
  ratingRenderDtl: '/biz/statistics/rating/renderDtl',
  ratingRenderCustomDtl: '/biz/statistics/rating/renderCustomDtl',
  ratingUpdCustom: '/biz/statistics/rating/update/custom',
  ratingPublishData: '/biz/statistics/rating/publishData',
  ratingRenderRealDtl: '/biz/statistics/rating/renderRealDtl',

  typeStatistics: '/biz/statistics/type/recovery',
  typeRenderDtl: '/biz/statistics/type/renderDtl',
  typeRenderCustomDtl: '/biz/statistics/type/renderCustomDtl',
  typeUpdCustom: '/biz/statistics/type/update/custom',
  typePublishData: '/biz/statistics/type/publishData',
  typeRenderRealDtl: '/biz/statistics/type/renderRealDtl',

  industryStatistics: '/biz/statistics/industry/recovery',
  industryRenderDtl: '/biz/statistics/industry/renderDtl',
  industryRenderCustomDtl: '/biz/statistics/industry/renderCustomDtl',
  industryUpdCustom: '/biz/statistics/industry/update/custom',
  industryPublishData: '/biz/statistics/industry/publishData',
  industryRenderRealDtl: '/biz/statistics/industry/renderRealDtl',

  thinkTankPageList: '/biz/thinkTank/pageList',
  thinkTankList: '/biz/thinkTank/list',
  thinkTankAdd: '/biz/thinkTank/add',
  thinkTankUpdate: '/biz/thinkTank/update',
  thinkTankDelete: '/biz/thinkTank/delete',
  thinkTankEnable: '/biz/thinkTank/enable',
  thinkTankExportExcel: '/biz/thinkTank/exportExcel',
  thinkTankExportTemplate: '/biz/thinkTank/exportTemplate',
  thinkTankImportExcel: '/biz/thinkTank/importExcel'
}
export default api


/**
 * 负责人、主要成员新增
 */
export function memberAdd(data) {
  return axios({
    url: api.memberAdd,
    method: 'post',
    data
  })
}

/**
 * 会员活动列表
 */
export function centerGetList(params) {
  return axios({
    url: api.centerGetList,
    method: 'get',
    params
  })
}

/**
 * 会员活动新增
 */
export function centerAdd(data) {
  return axios({
    url: api.centerAdd,
    method: 'post',
    data
  })
}

/**
 * 会员活动编辑
 */
export function centerEdit(data) {
  return axios({
    url: api.centerEdit,
    method: 'post',
    data
  })
}

/**
 * 会员活动删除
 */
export function centerDel(data) {
  return axios({
    url: api.centerDel + '/' + data.ids,
    method: 'post'
  })
}

/**
 * 会员数据统计和恢复
 */
export function memberStatistics(params) {
  return axios({
    url: api.memberStatistics,
    method: 'post',
    params
  })
}

/**
 * 会员渲染详情
 */
export function memberRenderDtl(params) {
  return axios({
    url: api.memberRenderDtl,
    method: 'get',
    params
  })
}

/**
 * 会员渲染详情(真实数据)
 */
export function memberRenderRealDtl(params) {
  return axios({
    url: api.memberRenderRealDtl,
    method: 'get',
    params
  })
}

/**
 * 会员渲染详情(自定义数据)
 */
export function memberRenderCustomDtl(params) {
  return axios({
    url: api.memberRenderCustomDtl,
    method: 'get',
    params
  })
}

/**
 * 更新会员统计数据(自定义)
 */
export function memberUpdCustom(data) {
  return axios({
    url: api.memberUpdCustom,
    method: 'post',
    data
  })
}

/**
 * 发布会员数据
 */
export function memberPublishData(data) {
  return axios({
    url: api.memberPublishData,
    method: 'post',
    data
  })
}

/**
 * 职务数据统计和恢复
 */
export function levelStatistics(params) {
  return axios({
    url: api.levelStatistics,
    method: 'post',
    params
  })
}

/**
 * 职务渲染详情
 */
export function levelRenderDtl(params) {
  return axios({
    url: api.levelRenderDtl,
    method: 'get',
    params
  })
}

/**
 * 职务渲染详情(真实数据)
 */
export function levelRenderRealDtl(params) {
  return axios({
    url: api.levelRenderRealDtl,
    method: 'get',
    params
  })
}

/**
 * 职务渲染详情(自定义数据)
 */
export function levelRenderCustomDtl(params) {
  return axios({
    url: api.levelRenderCustomDtl,
    method: 'get',
    params
  })
}

/**
 * 更新职务统计数据(自定义)
 */
export function levelUpdCustom(data) {
  return axios({
    url: api.levelUpdCustom,
    method: 'post',
    data
  })
}

/**
 * 发布职务数据
 */
export function levelPublishData(data) {
  return axios({
    url: api.levelPublishData,
    method: 'post',
    data
  })
}

/**
 * 评级数据统计和恢复
 */
export function ratingStatistics(params) {
  return axios({
    url: api.ratingStatistics,
    method: 'post',
    params
  })
}

/**
 * 评级渲染详情
 */
export function ratingRenderDtl(params) {
  return axios({
    url: api.ratingRenderDtl,
    method: 'get',
    params
  })
}

/**
 * 评级渲染详情(真实数据)
 */
export function ratingRenderRealDtl(params) {
  return axios({
    url: api.ratingRenderRealDtl,
    method: 'get',
    params
  })
}

/**
 * 评级渲染详情(自定义数据)
 */
export function ratingRenderCustomDtl(params) {
  return axios({
    url: api.ratingRenderCustomDtl,
    method: 'get',
    params
  })
}

/**
 * 更新评级统计数据(自定义)
 */
export function ratingUpdCustom(data) {
  return axios({
    url: api.ratingUpdCustom,
    method: 'post',
    data
  })
}

/**
 * 发布评级数据
 */
export function ratingPublishData(data) {
  return axios({
    url: api.ratingPublishData,
    method: 'post',
    data
  })
}

/**
 * 类型数据统计和恢复
 */
export function typeStatistics(params) {
  return axios({
    url: api.typeStatistics,
    method: 'post',
    params
  })
}

/**
 * 类型渲染详情
 */
export function typeRenderDtl(params) {
  return axios({
    url: api.typeRenderDtl,
    method: 'get',
    params
  })
}

/**
 * 类型渲染详情(真实数据)
 */
export function typeRenderRealDtl(params) {
  return axios({
    url: api.typeRenderRealDtl,
    method: 'get',
    params
  })
}

/**
 * 类型渲染详情(自定义数据)
 */
export function typeRenderCustomDtl(params) {
  return axios({
    url: api.typeRenderCustomDtl,
    method: 'get',
    params
  })
}

/**
 * 更新类型统计数据(自定义)
 */
export function typeUpdCustom(data) {
  return axios({
    url: api.typeUpdCustom,
    method: 'post',
    data
  })
}

/**
 * 发布类型数据
 */
export function typePublishData(data) {
  return axios({
    url: api.typePublishData,
    method: 'post',
    data
  })
}

/**
 * 行业数据统计和恢复
 */
export function industryStatistics(params) {
  return axios({
    url: api.industryStatistics,
    method: 'post',
    params
  })
}

/**
 * 行业渲染详情
 */
export function industryRenderDtl(params) {
  return axios({
    url: api.industryRenderDtl,
    method: 'get',
    params
  })
}

/**
 * 行业渲染详情(真实数据)
 */
export function industryRenderRealDtl(params) {
  return axios({
    url: api.industryRenderRealDtl,
    method: 'get',
    params
  })
}

/**
 * 行业渲染详情(自定义数据)
 */
export function industryRenderCustomDtl(params) {
  return axios({
    url: api.industryRenderCustomDtl,
    method: 'get',
    params
  })
}

/**
 * 更新行业统计数据(自定义)
 */
export function industryUpdCustom(data) {
  return axios({
    url: api.industryUpdCustom,
    method: 'post',
    data
  })
}

/**
 * 发布行业数据
 */
export function industryPublishData(data) {
  return axios({
    url: api.industryPublishData,
    method: 'post',
    data
  })
}

/**
 * 行业智库列表
 */
export function thinkTankPageList(params) {
  return axios({
    url: api.thinkTankPageList,
    method: 'get',
    params
  })
}

/**
 * 行业智库下拉列表
 */
export function thinkTankList(params) {
  return axios({
    url: api.thinkTankList,
    method: 'get',
    params
  })
}

/**
 * 行业智库新增
 */
export function thinkTankAdd(data) {
  return axios({
    url: api.thinkTankAdd,
    method: 'post',
    data
  })
}

/**
 * 行业智库编辑
 */
export function thinkTankUpdate(data) {
  return axios({
    url: api.thinkTankUpdate,
    method: 'post',
    data
  })
}

/**
 * 行业智库删除
 */
export function thinkTankDelete(data) {
  return axios({
    url: api.thinkTankDelete + '/' + data.ids,
    method: 'delete'
  })
}

/**
 * 行业智库禁用启用
 */
export function thinkTankEnable(data) {
  return axios({
    url: api.thinkTankEnable + '/' + data.id + '/' + data.status,
    method: 'post'
  })
}

/**
 * 行业智库导出模板
 */
export function thinkTankExportTemplate() {
  axios({
    url: api.thinkTankExportTemplate,
    method: 'get',
    responseType: 'blob',
    timeout: 0
  }).then(res => {
    resolveBlob(res, mimeMap.xlsx)
  })
}

/**
 * 行业智库导出
 */
export function thinkTankExportExcel(params) {
  axios({
    url: api.thinkTankExportExcel,
    method: 'get',
    responseType: 'blob',
    params
  }).then(res => {
    resolveBlob(res, mimeMap.xlsx)
  })
}
/**
 * 行业智库导入
 */
export function thinkTankImportExcel(data) {
  return axios({
    url: api.thinkTankImportExcel,
    method: 'post',
    data,
    responseType: 'blob',
    timeout: 0,
    headers: { 'Content-Type': mimeMap.xlsx }
  })
}
